<%-- 
    Document   : urediDogodek
    Created on : 28.6.2011, 22:59:20
    Author     : tincek
--%>

<%@page import="java.text.SimpleDateFormat"%>
<%@page import="gandalf.model.Dogodek"%>
<%@page import="gandalf.controller.DogodekDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
        <link rel="stylesheet" href="css/style.css" type="text/css" media="screen, projection">
        <link rel="stylesheet" href="blueprint/src/forms.css" type="text/css" media="screen, projection">
    </head>
    <%
                DogodekDao dogodekDao = new DogodekDao();

                Long idDogodek = Long.parseLong(request.getParameter("id"));

                Dogodek d = dogodekDao.findDogodek(idDogodek);
                request.getSession().setAttribute("dogodek_id", idDogodek);


    %>
    <body>
        <div id="section" class="container">
            <form action="Dogodek" method="POST">
                <ul>
                    <li>
                        <label for="naziv">Ime dogodka</label><br>
                        <input class="title" type="text" name="naziv" value="<%=d.getNaziv()%>">
                    </li>
                    <li>
                        <label for="opis">Dodatne informacije o dogodku</label><br>
                        <textarea name="opis" rows="4" cols="20"><%=d.getOpis()%></textarea>
                    </li>
                    <li>
                        <label for="datum">Datum</label><br>
                        <input type="text" name="datum" value="<%=new SimpleDateFormat("dd.MM.yyyy").format(d.getDatum())%>">

                        <label for="ura">Ura </label>
                        <select name="ura">
                            <% for(int i = 0; i < 24; i++) { %>
                                <option><%= (i/10 == 0 ? "0" + i : i) %></option>
                            <% } %>
                        </select>
                        <select name="minute">
                            <% for(int i = 0; i < 60; i++) { %>
                                <option><%= (i/10 == 0 ? "0" + i : i) %></option>
                            <% } %>
                        </select>
                    </li>
                    <li>
                        <label for="opis">Kategorija <%=d.getKategorija()%></label>
                        <select name="kategorija">
                            <option>Koncerti</option>
                            <option>Festivali</option>
                            <option>Gledališče</option>
                        </select>
                    </li>
                    <li>
                        <label for="objavljen">Objavljen</label><br>
                        <input type="checkbox" name="objavljen" value="1"
                               <%if (d.isObjavljen()) out.println("checked");%>/>
                    </li>
                </ul>
                <input name="submit" type="submit" value="Potrdi">
                <input name="submit" type="submit" value="Spremeni ostalo">
            </form>
        </div>
    </body>
</html>
